import {getshanchu} from '@/api/myapi/jiluwenjian';
export default {
  methods: {
    // 添加规范文件
    addguifan() {
      this.$refs.specificationFile.open();
    },
    // 添加记录文件
    addjilu() {
      this.$refs.logFile.open();
    },
    //   删除记录文件
    deljilu(form, i) {
      getshanchu({
        templateFile: form.jiluFileList[i].templateFilex
      }).then(({
        data
      }) => {
        console.log(data)
        if (data.code == 200) {
          form.jiluFileList.splice(i, 1);
          form.jiluFilesIds = form.jiluFileList.map(e => e.id).join(',');
        }
      });
    },
    //  删除规范文件
    delguifan(form, i) {
      form.guifanFileList.splice(i, 1);
      form.guifanFilesIds = form.guifanFileList.map(e => e.id).join(',');
    },
    //   确定选择文件
    onFileConfirm(item, form) {
      console.log(item)
      console.log(form)
      if (item.type == 'guifan') {
        form.guifanFileList = item.file;
        form.guifanFilesIds = item.file.map(e => e.id).join(',');
      } else {
        form.jiluFileList = item.file;
        form.jiluFilesIds = item.file.map(e => e.id).join(',');
      }
    },
    //   删除模板数量
    delFile(i) {
      this.formList.splice(i, 1);
    }
  }
}
